package com.example.javaairportflightanalysis.dao.sql;

import io.micrometer.common.util.StringUtils;
import org.apache.ibatis.jdbc.SQL;

public class DfmeBllsSqlProvider {

    public String selectLuggage(String fide,String ddtm,String code){
        return new SQL(){{
            SELECT("vmdb.ddtm,vmdb.fide,vmdb.btno,vmdb.code,vmdb.estr,vmdb.eend,vmdb.rstr,vmdb.rend");
            FROM("VW_META_DFME_BLLS vmdb");
            if (StringUtils.isNotBlank(fide)) {
                WHERE("fide=#{fide}");
            }
            if (StringUtils.isNotBlank(ddtm)){
                WHERE("ddtm like '%${ddtm}%'");
            }
            if (StringUtils.isNotBlank(code)){
                WHERE("code=#{code}");
            }
        }}.toString();
    }
}
